package com.zkzx.common.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * 北京中科智兴物联科技有限公司 @版权所有
 *
 * @Author: zhaoyihe@zkraising.com
 * @Date: 2021/05/08/13:42
 * @Description:
 */
@Getter
@AllArgsConstructor
public enum SourceEnum {


    ONESELF(0,"自建"),

    SHARE(1,"共享");


    private int value;

    private String description;


    /**
     *  获取name
     * @param name 枚举值
     * @return 枚举名
     */
    public static String getName(String name){
        if(StringUtils.isEmpty(name)){
            return null;
        }
        return SourceEnum.valueOf(name).name();
    }

    /**
     * 获取value
     * @param name 枚举值
     * @return 枚举简介
     */
    public static  String getValue(String name){
        if(StringUtils.isEmpty(name)){
            return null;
        }
        return SourceEnum.valueOf(name).description;
    }
}

